package com.homestead.elasticsearch.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.util.Date;

/**
 * @author HanBin_Yang
 * @since 2021/4/18 14:16
 */
@Data
@Document(indexName = "promotion", type = "couponTheme", replicas = 0)
public class CouponThemeEsDoc {
    /**
     * 券主题id
     */
    @Id
    private Long id;
    /**
     * 费用归属组织id
     */
    @Field(type = FieldType.Long)
    private Long belongingOrgId;
    /**
     * 券主题名称
     */
    @MultiField(mainField = @Field(type = FieldType.Text), otherFields = {
            @InnerField(suffix = "keyword", type = FieldType.Keyword),
            @InnerField(suffix = "ik_smart", type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    })
    private String themeTitle;
    /**
     * 券名称
     */
    @Field(type = FieldType.Keyword)
    private String couponName;

    /**
     * 券码生成方式 0自动生成 1第三方券码
     */
    @Field(type = FieldType.Integer)
    private Integer couponType;
    /**
     * 适用范围 0平台券 1集团券 2商家券 3店铺券
     */
    @Field(type = FieldType.Integer)
    private Integer themeType;
    /**
     * 活动开始时间
     */
    @Field(type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss",format = DateFormat.custom)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    /**
     * 活动结束时间
     */
    @Field(type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss",format = DateFormat.custom)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    /**
     * 发布人群 0是会员 1是机构经纪人 2是C端用户
     */
    @Field(type = FieldType.Integer)
    private Integer pubPort;
    /**
     * 活动状态 0未审核 1待审核 2审核不通过 3未开始 4进行中 5已关闭
     */
    @Field(type = FieldType.Integer)
    private Integer status;
}
